//
//  LCCarouselTbCell.m
//  TheLCNews
//
//  Created by apple on 15/11/27.
//  Copyright © 2015年 LC. All rights reserved.
//

#import "LCCarouselTbCell.h"

@implementation LCCarouselTbCell


#pragma mark 初始化方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

// 创建View
- (void)createView{
    // 图片
    self.thumbnailImageView = [[UIImageView alloc] init];
//    self.thumbnailImageView.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.thumbnailImageView];
    
    self.thumbnailImageView.layer.shadowOffset = CGSizeMake(0, 0);
    self.thumbnailImageView.layer.shadowColor = [UIColor blackColor].CGColor;
    self.thumbnailImageView.layer.shadowOpacity = 0.8;
    self.thumbnailImageView.layer.shadowRadius = 1;
    
    // 标题
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
//    self.titleLabel.backgroundColor = [UIColor yellowColor];
    // 设置行数 0为最大行数
    self.titleLabel.numberOfLines = 0;
    // 可以自动适应文本内容
    [self.titleLabel sizeToFit];
    
    // 时间
    self.timeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.timeLabel];
    self.timeLabel.font = [UIFont systemFontOfSize:12.];
//    self.timeLabel.textColor = [UIColor cyanColor];
//    self.timeLabel.backgroundColor = [UIColor yellowColor];
    
    // 评论
    self.commentlabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.commentlabel];
    self.commentlabel.font = [UIFont systemFontOfSize:12.];
//    self.commentlabel.textColor = [UIColor cyanColor];
//    self.commentlabel.backgroundColor = [UIColor redColor];
}

#pragma mark 设置frame,layoutSubviews方法
- (void)layoutSubviews{
    [super layoutSubviews];
    
    // 图片frame
    self.thumbnailImageView.frame = CGRectMake(CWIDTH / 1.5, [UIScreen mainScreen].bounds.size.height / 66.7, CWIDTH / 3.4, [UIScreen mainScreen].bounds.size.height / 7);
    
    // 标题frame
    self.titleLabel.frame = CGRectMake(CWIDTH / 37.5, [UIScreen mainScreen].bounds.size.height / 66.7, CWIDTH / 1.63, [UIScreen mainScreen].bounds.size.height / 9.53);
    
    // 时间frame
    self.timeLabel.frame = CGRectMake(CWIDTH / 3.75, [UIScreen mainScreen].bounds.size.height / 7.4, CWIDTH / 4.7, [UIScreen mainScreen].bounds.size.height / 33.35);
    
    // 评论frame
    self.commentlabel.frame = CGRectMake(CWIDTH / 37.5, [UIScreen mainScreen].bounds.size.height / 7.4, CWIDTH / 4.7, [UIScreen mainScreen].bounds.size.height / 33.35);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
